<!--
 @description 收货地址编辑/新增
 @fileName Item.vue
 @author zengqiongying
 @created 2023/04/28 14:36:41
-->
<template>
  <div>
    <Cell
      v-if="!hideName"
      :modelValue="modelValue.name"
      title="收货地址名称"
      placeholder="请输入"
      readonly
      defaultValue="--"
      custom
    />
    <Cell title="所在省市区" custom readonly default-value="--">
      {{ provinceCityCounty }}
    </Cell>
    <Cell title="详细地址" custom readonly default-value="--">
      {{ modelValue.address }}
    </Cell>

    <Cell title="第一联系人" placeholder="无" custom readonly>
      {{ modelValue.firstReceiver }} {{ modelValue.firstReceiverTel }} {{ modelValue.firstReceiverPhone }}
    </Cell>
    <Cell v-if="modelValue.secondReceiver" title="第二联系人" placeholder="无" custom readonly>
      {{ modelValue.secondReceiver }} {{ modelValue.secondReceiverTel }} {{ modelValue.secondReceiverPhone }}
    </Cell>
    <Cell v-if="modelValue.thirdReceiver" title="第三联系人" placeholder="无" custom readonly>
      {{ modelValue.thirdReceiver }} {{ modelValue.thirdReceiverTel }} {{ modelValue.thirdReceiverPhone }}
    </Cell>
  </div>
</template>

<script>
  import { defineComponent, computed } from 'vue'
  import Cell from '@/components/Cell/index.vue'
  export default defineComponent({
    name: 'DealerReciveAddressItemView',
    components: { Cell },
    props: {
      modelValue: {
        type: Object,
        default: () => {}
      },
      hideName: {
        type: Boolean,
        default: false
      }
    },
    setup(props) {
      const provinceCityCounty = computed(() => {
        const { provinceName, cityName, countyName, townName } = props.modelValue
        return `${provinceName || ''}${cityName || ''}${countyName || ''}${townName || ''}`
      })
      return {
        provinceCityCounty
      }
    }
  })
</script>
<style lang="less" scoped></style>
